package com.haotunet.app.goldtreasure.net;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.haotunet.app.goldtreasure.model.BankModel;
import com.haotunet.app.goldtreasure.model.BannerModel;
import com.haotunet.app.goldtreasure.model.BaseModel;
import com.haotunet.app.goldtreasure.model.BuyConfirmModel;
import com.haotunet.app.goldtreasure.model.BuyGoldDetail;
import com.haotunet.app.goldtreasure.model.BuyRecordModel;
import com.haotunet.app.goldtreasure.model.CardModel;
import com.haotunet.app.goldtreasure.model.CoinModel;
import com.haotunet.app.goldtreasure.model.CouponModel;
import com.haotunet.app.goldtreasure.model.DepositOrder;
import com.haotunet.app.goldtreasure.model.DepositRecordDetailModel;
import com.haotunet.app.goldtreasure.model.DepositRecordModel;
import com.haotunet.app.goldtreasure.model.DepositReseverModel;
import com.haotunet.app.goldtreasure.model.ExchangePageInfo;
import com.haotunet.app.goldtreasure.model.ExchangeRecordDetailModel;
import com.haotunet.app.goldtreasure.model.ExchangeRecordModel;
import com.haotunet.app.goldtreasure.model.GoldInfo;
import com.haotunet.app.goldtreasure.model.HomePageModel;
import com.haotunet.app.goldtreasure.model.InvitePageInfo;
import com.haotunet.app.goldtreasure.model.ManageGold;
import com.haotunet.app.goldtreasure.model.MediaModel;
import com.haotunet.app.goldtreasure.model.MsgInfo;
import com.haotunet.app.goldtreasure.model.OrderInfo;
import com.haotunet.app.goldtreasure.model.PersonalInfo;
import com.haotunet.app.goldtreasure.model.PickRecordDetailModel;
import com.haotunet.app.goldtreasure.model.PickRecordModel;
import com.haotunet.app.goldtreasure.model.ProfitModel;
import com.haotunet.app.goldtreasure.model.RecommendProductModel;
import com.haotunet.app.goldtreasure.model.RedPacketDetailModel;
import com.haotunet.app.goldtreasure.model.RegularProfitModel;
import com.haotunet.app.goldtreasure.model.SellPageInfo;
import com.haotunet.app.goldtreasure.model.SellRecordModel;
import com.haotunet.app.goldtreasure.model.SignModel;
import com.haotunet.app.goldtreasure.model.StoreInfo;
import com.haotunet.app.goldtreasure.model.StoreModel;
import com.haotunet.app.goldtreasure.model.TipsInfo;
import com.haotunet.app.goldtreasure.model.UserInfo;
import com.haotunet.app.goldtreasure.model.VaultInfo;
import com.haotunet.app.goldtreasure.model.VaultRecordModel;
import com.haotunet.app.goldtreasure.model.VersionModel;
import com.haotunet.app.goldtreasure.model.WalletDetailModel;
import com.haotunet.app.goldtreasure.model.WalletInfo;
import com.haotunet.app.goldtreasure.model.WithDrawRecordModel;

public class ParserUtil {

    public static UserInfo parserCheckLogin(String jsonStr) {
        return getNewModel(jsonStr, UserInfo.class);
    }

    public static GoldInfo parserCurrentGoldPrice(String jsonStr) {
        return getNewModel(jsonStr, GoldInfo.class);
    }

    public static ManageGold parserManageGoldTotalQuantity(String jsonStr) {
        return getNewModel(jsonStr, ManageGold.class);
    }
    public static BuyGoldDetail parserGetGoldDetail(String jsonStr) {
        return getNewModel(jsonStr, BuyGoldDetail.class);
    }
    public static BannerModel parserBanner(String jsonStr) {
        return getNewModel(jsonStr, BannerModel.class);
    }

    public static RecommendProductModel parserRecommendProduct(String jsonStr) {
        return getNewModel(jsonStr, RecommendProductModel.class);
    }

    public static BaseModel parserGetRegisterCode(String jsonStr) {
        return getNewModel(jsonStr, BaseModel.class);
    }

    public static SignModel parserGetEverydaySign(String jsonStr) {
        return getNewModel(jsonStr, SignModel.class);
    }

    public static UserInfo parserAddRegisterInfo(String jsonStr) {
        return getNewModel(jsonStr, UserInfo.class);
    }

    public static HomePageModel parserGetHomePageInfo(String jsonStr) {
        return getNewModel(jsonStr, HomePageModel.class);
    }

    public static SellPageInfo parserGetSellPageInfo(String jsonStr) {
        return getNewModel(jsonStr, SellPageInfo.class);
    }

    public static RecommendProductModel parserGetProductListInfo(String jsonStr) {
        return getNewModel(jsonStr, RecommendProductModel.class);
    }

    public static CoinModel parserGetGoldCoinInfo(String jsonStr) {
        return getNewModel(jsonStr, CoinModel.class);
    }

    public static RedPacketDetailModel parserGetRedPacketDetail(String jsonStr) {
        return getNewModel(jsonStr, RedPacketDetailModel.class);
    }

    public static MediaModel parserGetDiscoverNews(String jsonStr) {
        return getNewModel(jsonStr, MediaModel.class);
    }
    public static SellRecordModel parserGetSellRecord(String jsonStr) {
        return getNewModel(jsonStr, SellRecordModel.class);
    }

    public static DepositRecordModel parserGetDepositRecord(String jsonStr) {
        return getNewModel(jsonStr, DepositRecordModel.class);
    }

    public static PickRecordModel parserGetExtractRecord(String jsonStr) {
        return getNewModel(jsonStr, PickRecordModel.class);
    }

    public static BuyRecordModel parserGetCurrentBuyRecord(String jsonStr) {
        return getNewModel(jsonStr, BuyRecordModel.class);
    }

    public static CouponModel parserGetMyCoupons(String jsonStr) {
        return getNewModel(jsonStr, CouponModel.class);
    }


    public static <T> T getNewModel(String jsonStr, Class<T> cls) {
        T t = null;
        try {
            JSONObject jsonObj = JSONObject.parseObject(jsonStr);
            t = JSON.parseObject(jsonObj.toJSONString(), cls);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return t;
    }

    public static MsgInfo parserMsgInfo(String jsonStr) {
        return getNewModel(jsonStr, MsgInfo.class);
    }

    public static GoldInfo parserGetMyCurrentGold(String jsonStr) {
        return getNewModel(jsonStr, GoldInfo.class);
    }

    public static DepositReseverModel parserGetAllShopPositionInfo(String jsonStr) {
        return getNewModel(jsonStr, DepositReseverModel.class);
    }

    public static DepositOrder getDepositReseverOrder(String jsonStr) {
        return getNewModel(jsonStr, DepositOrder.class);
    }

    public static CardModel parserGetMyCardList(String jsonStr) {
        return getNewModel(jsonStr, CardModel.class);
    }

    public static VaultInfo parserGetVaultPageInfo(String jsonStr) {
        return getNewModel(jsonStr, VaultInfo.class);
    }

    public static WalletDetailModel parserGetWalletDetail(String jsonStr) {
        return getNewModel(jsonStr, WalletDetailModel.class);
    }

    public static PersonalInfo parserGetPersonalPageInfo(String jsonStr) {
        return getNewModel(jsonStr, PersonalInfo.class);
    }

    public static ProfitModel parserGetMyProfit(String jsonStr) {
        return getNewModel(jsonStr, ProfitModel.class);
    }

    public static WithDrawRecordModel parserGetWithdrawRecord(String jsonStr) {
        return getNewModel(jsonStr, WithDrawRecordModel.class);
    }

    public static InvitePageInfo parserGetInvitePageInfo(String jsonStr) {
        return getNewModel(jsonStr, InvitePageInfo.class);
    }

    public static BuyConfirmModel parserConfirmChoose(String jsonStr) {
        return getNewModel(jsonStr, BuyConfirmModel.class);
    }

    public static OrderInfo parserMakeOrderOperation(String jsonStr) {
        return getNewModel(jsonStr, OrderInfo.class);
    }

    public static TipsInfo parserTipsInfo(String jsonStr) {
        return getNewModel(jsonStr, TipsInfo.class);
    }

    public static RegularProfitModel parserGetRegularProfitRecord(String jsonStr) {
        return getNewModel(jsonStr, RegularProfitModel.class);
    }

    public static StoreModel parserGetStoreList(String jsonStr) {
        return getNewModel(jsonStr, StoreModel.class);
    }

    public static RegularProfitModel parserGetMatureProduct(String jsonStr) {
        return getNewModel(jsonStr, RegularProfitModel.class);
    }

    public static WalletInfo parserGetWalletPageInfo(String jsonStr) {
        return getNewModel(jsonStr, WalletInfo.class);
    }

    public static StoreInfo parserGetStoreDetailInfo(String jsonStr) {
        return getNewModel(jsonStr, StoreInfo.class);
    }

    public static VaultRecordModel parserGetVaultRecordInfo(String jsonStr) {
        return getNewModel(jsonStr, VaultRecordModel.class);
    }

    public static PickRecordDetailModel parserGetPickRecordDetail(String jsonStr) {
        return getNewModel(jsonStr, PickRecordDetailModel.class);
    }

    public static DepositRecordDetailModel parserGetDepositRecordDetail(String jsonStr) {
        return getNewModel(jsonStr, DepositRecordDetailModel.class);
    }

    public static ExchangeRecordDetailModel parserGetExchangeRecordDetail(String jsonStr) {
        return getNewModel(jsonStr, ExchangeRecordDetailModel.class);
    }

    public static ExchangeRecordModel parserGetExchangeRecord(String jsonStr) {
        return getNewModel(jsonStr, ExchangeRecordModel.class);
    }

    public static ExchangePageInfo parserGetExchangePageInfo(String jsonStr) {
        return getNewModel(jsonStr, ExchangePageInfo.class);
    }

    public static GoldInfo parserGetMyTotalGold(String jsonStr) {
        return getNewModel(jsonStr, GoldInfo.class);
    }

    public static VersionModel parserCheckVersion(String jsonStr) {
        return getNewModel(jsonStr, VersionModel.class);
    }


    public static BankModel getSupportBankList(String jsonStr) {
        return getNewModel(jsonStr, BankModel.class);
    }
}
